/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/********************************************************************************************************
 *  \file     Adc_ConfigTypes.h                                                                         *
 *  \brief    This file contains adc types which will be influenced by config file                      *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date           <th>Version                                                                   *
 * <tr><td>2023/08/29     <td>1.0.0                                                                     *
 * </table>                                                                                             *
 *******************************************************************************************************/

#ifndef ADC_CONFIGTYPES_H
#define ADC_CONFIGTYPES_H

#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************************
 *                       Include header files
 *******************************************************************************************************/
#include <Std_Types.h>
#include "Adc_Types.h"
#include "Adc_Cfg.h"

/**
 *  \addtogroup MCAL_ADC_CFG Adc Configuration.
 *
 * This files defines ADC MCAL configuration structures
 *  \{
 */

/** \brief  Type for power state currently active or set as target
 *          power state.                                                */
/** Traceability    :   SWSR_ADC_049                                    */
typedef enum
{
    ADC_FULL_POWER = 0U,
    ADC_LOW_POWER
} Adc_PowerStateType;

#if (ADC_POWER_STATE_SUPPORTED == STD_ON)
/** \brief  Type for result of power state.                             */
/** Traceability    :   SWSR_ADC_030 SWSR_ADC_050                       */
typedef enum
{
    ADC_SERVICE_ACCEPTED = 0U,
    ADC_NOT_INIT,
    ADC_SEQUENCE_ERROR,
    ADC_POWER_STATE_NOT_SUPP,
    ADC_TRANS_NOT_POSSIBLE
} Adc_PowerStateRequestResultType;

/** \brief  Type for confirming Adc_PrePowerState is beginning of a
 *           Adc Power State transition.                                */
/** Traceability    :   SWSR_ADC_026 SWSR_ADC_027 */
typedef enum
{
    ADC_POWER_CHANGE_NOT_START = 0U,
    ADC_POWER_CHANGE_START,
} Adc_PowerChangeType;

/** \brief  Type for confirming current power state is the same as the
 *          target power state.                                         */
typedef enum
{
    ADC_POWER_SAME = 0U,
    ADC_POWER_DIFF,
} Adc_PowerCheckType;
#endif /* (ADC_POWER_STATE_SUPPORTED == STD_ON) */

/** \brief  Type for recording hardware trigger enabled/disabled.       */
#if(ADC_HW_TRIGGER_API == STD_ON)
typedef enum
{
    ADC_HARDWARE_NO_TRIGGERRING = 0U,
    ADC_HARDWARE_TRIGGERRING
} Adc_HardwareTriggerType;
#endif /* #if(ADC_HW_TRIGGER_API == STD_ON) */

#if (ADC_GRP_NOTIF_CAPABILITY == STD_ON)
/** \brief Type for indicates if notification is enabled for the group. */
/** Traceability    :   SWSR_ADC_018                                    */
typedef enum
{
    ADC_NOTIFICATION_DISABLED = 0U,
    ADC_NOTIFICATION_ENABLED
} Adc_NotificationType;
#endif /* #if (ADC_GRP_NOTIF_CAPABILITY == STD_ON) */

/** \brief  Type for all group information.                             */
typedef struct
{
    volatile Adc_StatusType groupStatus;
    volatile Adc_GroupBusyType groupConvStatus;
    volatile Adc_GroupValueUpdateType groupValueStatus;
    /** Traceability    :   SWSR_ADC_037 SWSR_ADC_038                       */
    volatile Adc_StreamNumSampleType groupConvFinishTime;
    volatile Adc_StreamNumSampleType groupConvFinishIndex;
#if(ADC_HW_TRIGGER_API == STD_ON)
    volatile Adc_HardwareTriggerType groupHardwareTrigger;
#endif /* #if(ADC_HW_TRIGGER_API == STD_ON) */
#if (ADC_GRP_NOTIF_CAPABILITY == STD_ON)
    /** Traceability    :   SWSR_ADC_157                                    */
    volatile Adc_NotificationType groupNotifStatus;
#endif /* #if (ADC_GRP_NOTIF_CAPABILITY == STD_ON) */
} Adc_GroupStatusType;
/** \} */

/** \brief  Type for Adc core handler type.                             */
/** Traceability       :SWSR_ADC_033                                    */
typedef struct
{
    /** \brief  indicate whether adc is initialized */
    Adc_GlobalStateType globalInitState;
    /** \brief  save all group information */
    Adc_GroupStatusType allGrpInfo[ADC_USED_GROUP_COUNT];
    /** \brief  save the user config */
    const Adc_ConfigType *globalConfigPtr;
#if (ADC_POWER_STATE_SUPPORTED == STD_ON)
    /** \brief  inticate whether power change starts of not */
    Adc_PowerChangeType powerStaChange;
    /** \brief  adc current power state */
    /** Traceability       : SWSR_ADC_027 */
    Adc_PowerStateType currPowerSta;
    /** \brief  adc target power state */
    /** Traceability       : SWSR_ADC_027 */
    Adc_PowerStateType targetPowerSta;
#endif /* #if (ADC_POWER_STATE_SUPPORTED == STD_ON) */
} Adc_CoreHandlerType;
/** \} */



#ifdef __cplusplus
}
#endif

#endif /* ADC_CONFIGTYPES_H */
/* End of file */
